package com.ctsi.framework.elementui.support;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;

public class Options implements Serializable {

    private List<Option> options = new ArrayList<>();

    private Options() {
    }

    public List<Option> getOptions() {
        return options;
    }

    public void setOptions(List<Option> options) {
        this.options = options;
    }

    public <T> Options addOptions(T t, Function<T,List<Option>> func){
        this.options.addAll(func.apply(t));
        return this;
    }

    public <T> Options addOption(T t, Function<T,Option> func){
        this.options.add(func.apply(t));
        return this;
    }

    public static Options init(){
        return new Options();
    }
}
